# example from https://github.com/harvester/ipxe-examples/blob/main/general/config-join.yaml

scheme_version: 1
server_url: https://{{ settings['harvester_network_config']['vip']['ip'] }}:443
token: {{ settings['harvester_config']['token'] }}
os:
  hostname: harvester-node-{{ node_number }}
  dns_nameservers:
{% for dns_server in settings['harvester_network_config']['dns_servers'] %}
  - {{ dns_server }}
{% endfor %}
  ssh_authorized_keys:
{% for ssh_key in settings['harvester_config']['ssh_authorized_keys'] %}
    - {{ ssh_key }}
{% endfor %}
  password: {{ settings['harvester_config']['password'] }}
  ntp_servers:
{% for ntp_server in settings['harvester_config']['ntp_servers'] %}
    - {{ ntp_server }}
{% endfor %}
{% if settings['harvester_network_config']['sftp'] %}
  sshd:
    sftp: {{ settings['harvester_network_config']['sftp'] }}
{% endif %}
install:
  mode: join
{% if settings['harvester_network_config']['cluster'][node_number |int]['role'] != 'default' %}
  role: {{ settings['harvester_network_config']['cluster'][node_number |int]['role'] }}
{% endif %}
  management_interface:
    interfaces:
    - name: {{ settings['harvester_network_config']['cluster'][node_number | int]['mgmt_interface'] }}  # The management interface name
    method: dhcp
  device: /dev/vda       # The target disk to install
  iso_url: http://{{ hostvars['pxe_server']['ansible_eth0']['ipv4']['address'] }}/harvester/harvester-amd64.iso
#  tty: ttyS1,115200n8   # For machines without a VGA console
  tty: ttyS0
